package com.nuoniu.sibanyun.controller.crm.call;


import com.nuoniu.sibanyun.common.BaseController;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.service.crm.call.ICrmCallMinutesDetailService;
import com.nuoniu.sibanyun.service.crm.call.ICrmCallMinutesService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 客户管理-呼叫分钟数 前端控制器
 * </p>
 *
 * @author 白强
 * @since 2022-05-25
 */
@RestController
@RequestMapping("/crm/callMinutes")
@Api(value="呼叫分钟数 ",tags={"呼叫分钟数"})
public class CrmCallMinutesController extends BaseController {
    @Autowired
    private ICrmCallMinutesService crmCallMinutesService;
    @Autowired
    private ICrmCallMinutesDetailService callMinutesDetailService;


    @GetMapping("isCallEnable")
    @ApiOperation(value = "是否可以外呼")
    public HttpResult isCallEnable() {
        return HttpResult.ok("",crmCallMinutesService.isCallEnable());
    }

    @GetMapping("getByCompany")
    @ApiOperation(value = "查询 当前租户 分钟数情况")
    public HttpResult pageAgentStatisticsBySystem() {
        return HttpResult.ok(crmCallMinutesService.getByCompany(null,true));
    }

    @PostMapping("changeRenewalType")
    @ApiOperation(value = "变更套餐续费方式")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "明细ID"),
            @ApiImplicitParam(name = "renewalType", value = "续费方式:1 手动 2自动")
    })
    public HttpResult changeRenewalType(Integer id,Integer renewalType) {
        callMinutesDetailService.changeRenewalType(id,renewalType);
        return HttpResult.ok();
    }




}
